﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace KnowledgeAssistant
{
    public partial class ThemeConcateForm : Form
    {
        private Theme dst;

        public ThemeConcateForm(Theme dst)
        {
            InitializeComponent();
            this.dst = dst;
        }

        private void ThemeConcateForm_Load(object sender, EventArgs e)
        {
            subjectsComboBox.DataSource = SubjectUtil.GetAllSubjects();
            subjectsComboBox.DisplayMember = "Name";
            if (subjectsComboBox.Items.Count != 0)
            {
                subjectsComboBox.SelectedIndex = 0;
            }

            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Theme src = (Theme)this.themesComboBox.SelectedValue;
            ThemeUtil.CopyQuestions(src, dst);
            this.Close();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Subject subj = (Subject)subjectsComboBox.SelectedValue;
            themesComboBox.DataSource = ThemeUtil.GetAllThemes(subj.SubjectID);
            themesComboBox.DisplayMember = "Name";
            if (themesComboBox.Items.Count == 0)
            {
                themesComboBox.Text = "";
            }
        }
    }
}
